<HTML><HEAD><TITLE>element(?Index, +List, ?Value)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(fd)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>element(?Index, +List, ?Value)</H1>
Value is the Index'th element of the integer list List.


<DL>
<DT><EM>?Index</EM></DT>
<DD>A variable or an integer.
</DD>
<DT><EM>+List</EM></DT>
<DD>A non-empty list of integers.
</DD>
<DT><EM>?Value</EM></DT>
<DD>A variable or an integer.
</DD>
</DL>
<H2>Description</H2>
   This constraints can be used in a variety of programs to state a
   relation between two domain variables.  List is a list of integers and
   the constraint states that its Index'th element is equal to Value, i.e.

<P>
<PRE>
                             List_Index = Value
</PRE>
   Every time Index or Value is updated, this constraint is activated and
   the domain of the other variable is updated accordingly.

<P>

<H3>Fail Conditions</H3>
   Fails if Value is not the Index'th element of List.


<H3>Resatisfiable</H3>
   No.
<H2>Examples</H2>
<PRE>
   [eclipse 13]: element(I, [1,3,6,3], V).
   I = I :: [1 .. 4]
   V = V :: [1, 3, 6]
   Delayed goals:
   element(I :: [1 .. 4], t(1, 3, 6, 3), V :: [1, 3, 6], 4, 3)
   yes.
   [eclipse 14]: element(I, [1,3,6,3], V), V ## 3.
   I = I :: [1, 3]
   V = V :: [1, 6]
   Delayed goals:
   element(I :: [1, 3], t(1, 3, 6, 3), V :: [1, 6], 2, 2)
   yes.



</PRE>
<H2>See Also</H2>
<A HREF="../../lib/fd/NN-2.html">:: / 2</A>, <A HREF="../../lib/fd/HNN-2.html">#:: / 2</A>, <A HREF="../../lib/fd/atmost-3.html">atmost / 3</A>
</BODY></HTML>
